﻿* Encoding: UTF-8.
* Töröljük a korábban létrehozott változót, ha létezik.
* DELETE VARIABLES Actual_Pattern.

* Létrehozzuk a string változót.
STRING Actual_Pattern (A50).

* Inicializáljuk üres stringgel.
COMPUTE Actual_Pattern = "".

* Hozzáadjuk a C-t.
IF (C=1) Actual_Pattern = "C".

* Hozzáadjuk a D-t.
IF (D=1 AND C=0) Actual_Pattern = "D". /* Csak akkor, ha C nem volt, és ez az első */
IF (D=1 AND C=1) Actual_Pattern = CONCAT(RTRIM(Actual_Pattern), "+D").

* Hozzáadjuk a W-t.
IF (W=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) = 0) Actual_Pattern = "W".
IF (W=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) > 0) Actual_Pattern = CONCAT(RTRIM(Actual_Pattern), "+W").

* Hozzáadjuk a B-t.
IF (B=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) = 0) Actual_Pattern = "B".
IF (B=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) > 0) Actual_Pattern = CONCAT(RTRIM(Actual_Pattern), "+B").

* Hozzáadjuk a Q-t.
IF (Q=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) = 0) Actual_Pattern = "Q".
IF (Q=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) > 0) Actual_Pattern = CONCAT(RTRIM(Actual_Pattern), "+Q").

* Hozzáadjuk az R-t.
IF (R=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) = 0) Actual_Pattern = "R".
IF (R=1 AND CHAR.LENGTH(RTRIM(Actual_Pattern)) > 0) Actual_Pattern = CONCAT(RTRIM(Actual_Pattern), "+R").

EXECUTE.

FREQUENCIES VARIABLES=Actual_Pattern
  /ORDER=ANALYSIS.
